package notestore;

import java.util.List;
import java.util.ArrayList;

import storeInterface.Store;
import note.TextAndImageNote;
import note.TextNote;

public class NoteStore implements Store {
    
    private List<TextNote> allTextNotes;
    private List<TextAndImageNote> allTextAndImageNotes;

    public NoteStore() {
        // init two arraylists
        allTextNotes = new ArrayList<>();
        allTextAndImageNotes = new ArrayList<>();
    }

    // init note instance referring to the url value
    public void storeNote(String message, String url) {
        if (url == null) {
            TextNote textNote = new TextNote(message);
            textNote.setID(allTextNotes.size()+1);
            allTextNotes.add(textNote);
        } else {
            TextAndImageNote imageNote = new TextAndImageNote(message, url);
            imageNote.setID(allTextAndImageNotes.size()+1);
            allTextAndImageNotes.add(imageNote);
        }
    }

    // implement method in interface
    public List<TextNote> getAllTextNotes() {
        return allTextNotes;
    }

    // implement method in interface
    public List<TextAndImageNote> getAllTextAndImageNotes() {
        return allTextAndImageNotes;
    }

}
